1   package jrre.gui;
2   
3   import jrre.event.*;
4   
5   import javax.swing.*;
6   import java.awt.*;
7   import java.awt.event.*;
8   
9   import java.beans.*;
10  
11  public class StackFrameGUI extends JPanel implements ActionListener, VMEventListener {
12          
13          private int width;
14          private int height;
15          
16          //private PropertyChangeSupport propertyChange = new PropertyChangeSupport(this);
17          private VMEventDispatcher eventDispatcher = new VMEventDispatcher();
18  
19          protected OperandStackGUI operandStackGUI;
20          
21          private JScrollPane operandStackPane,localVariableFramePane,instructionsTablePane;
22          
23          public StackFrameGUI(int width,int height){
24              super();
25              this.width = width;
26              this.height = height;
27              initLayout();
28              initPanels();
29          }
30  
31          private void initLayout(){
32              setSize(width,height);
33              setLayout(new GraphPaperLayout());
34              setLayout(new GraphPaperLayout(new Dimension(2,2)));
35              setBackground(Color.blue);
36  
37          }
38  
39          private void initPanels(){
40              operandStackGUI = new OperandStackGUI(width>>1, height>>1);  // Divide width by two.
41  
42              //propertyChange.addPropertyChangeListener(operandStackGUI);
43              eventDispatcher.addEventListener(operandStackGUI);
44              
45              operandStackPane = new JScrollPane(operandStackGUI,
46                                                      JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
47                                                      JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
48  
49              add(operandStackPane, new Rectangle(0,0,1,1));
50              
51          }
52  
53      public void receiveEvent(VMEvent event){
54  
55          eventDispatcher.fireEvent(event);
56      }
57    
58      public void actionPerformed(ActionEvent event){
59  
60      }
61  }
This page was automatically generated by Maven